//
//  ModifyPhoneNumberViewController.m
//  UcarTest
//
//  Created by 陈曦 on 16/3/16.
//  Copyright © 2016年 chenxi. All rights reserved.
//

#import "ModifyPhoneNumberViewController.h"
#import <CommonCrypto/CommonDigest.h>
#import "Define.h"
#import "TestTimer.h"
#import "MainPageViewController.h"
#import "AFNetworking.h"
#import "NetRequestGroup.h"
#import "Access_token.h"
#import "MBProgressHUD.h"
#import "NSString+Hash.h"
#import "MainPageViewController.h"


#define STORE_TIMER @"time.txt"  // STORE_TIMER为归档路径扩展名,可以随便改

@interface ModifyPhoneNumberViewController ()

@property (strong, nonatomic) TestTimer *timer;

@end

@implementation ModifyPhoneNumberViewController

- (void)viewWillAppear:(BOOL)animated {
    //检查定时器
    __weak typeof(self) bSelf = self;
    [[[TestTimer alloc] init] clickTimerClickButton:bSelf.needAuthBtn clickLabel:bSelf.getAuthLabel  addressStr:STORE_TIMER];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBarHidden = NO;
    
    //定义视图背景色
    self.view.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    
    //导航条名字
    //    self.navigationItem.title = @"快速注册";
    //    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor] , NSFontAttributeName : [UIFont boldSystemFontOfSize:18]};
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"修改手机号";
    self.navigationItem.titleView = titleLabel;
    
    //重定义返回键
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 0, 22, 22);
    [back setImage:[UIImage imageNamed:@"iconfont-fanhui-white"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(backTpMainView) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backBar = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backBar;
    
    //添加输入框
    [self inputTextField];
    
    
}
//==============================================================================

#pragma mark 输入框搭建
-(void)inputTextField{
    
    CGFloat inputSpaceValue = kScreenHeightEight * 0.7;
    
    UIView *inputView = [[UIView alloc] initWithFrame:CGRectMake(-0.5, kScreenHeightEight, kScreenWidth + 1, inputSpaceValue * 3)];
    inputView.layer.borderColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    inputView.layer.borderWidth = 0.5;
    inputView.layer.masksToBounds = YES;
    inputView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:inputView];
    
    //中间间隔线
    UILabel *septaLine = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidthTen / 2, inputSpaceValue, kScreenWidth - kScreenWidthTen / 2, 0.5)];
    septaLine.backgroundColor = lineColor;
    [inputView addSubview:septaLine];
    
    //中间间隔线
    UILabel *septaLine1 = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidthTen / 2, inputSpaceValue * 2, kScreenWidth - kScreenWidthTen / 2, 0.5)];
    septaLine1.backgroundColor = lineColor;
    [inputView addSubview:septaLine1];
    
    UIImageView *phoneImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidthTen / 2, inputSpaceValue / 4, inputSpaceValue / 2 * 0.92 / 1.55, inputSpaceValue / 2)];
    phoneImageView.image = [UIImage imageNamed:@"iconfont-shouji"];
    [inputView addSubview:phoneImageView];
    
    UIImageView *authCodeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidthTen / 2, inputSpaceValue / 4 + inputSpaceValue, inputSpaceValue / 2 * 1.13 / 1.41, inputSpaceValue / 2)];
    authCodeImageView.image = [UIImage imageNamed:@"iconfont-yanzhengma"];
    [inputView addSubview:authCodeImageView];
    
    UIImageView *passwordImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidthTen / 2, inputSpaceValue / 4 + inputSpaceValue * 2, inputSpaceValue / 2 * 1.13 / 1.41, inputSpaceValue / 2)];
    passwordImageView.image = [UIImage imageNamed:@"iconfont-password"];
    [inputView addSubview:passwordImageView];
    
    //手机号注册框
    self.movebiephoneNumberTextField = [[UITextField alloc] initWithFrame:CGRectMake(kScreenWidthTen * 1.5, inputSpaceValue / 4, kScreenWidth / 2, inputSpaceValue / 2)];
    self.movebiephoneNumberTextField.delegate = self;
    self.movebiephoneNumberTextField.placeholder = @"请输入手机号";
    self.movebiephoneNumberTextField.textAlignment = NSTextAlignmentLeft;
    self.movebiephoneNumberTextField.keyboardType = UIKeyboardTypeNumberPad;
    [inputView addSubview:self.movebiephoneNumberTextField];
    
    //验证码注册框
    self.authCodeTextField = [[UITextField alloc] initWithFrame:CGRectMake(kScreenWidthTen * 1.5, inputSpaceValue / 4 + inputSpaceValue, kScreenWidth / 2, inputSpaceValue / 2)];
    self.authCodeTextField.delegate = self;
    self.authCodeTextField.placeholder = @"请输入验证码";
    self.authCodeTextField.textAlignment = NSTextAlignmentLeft;
    self.authCodeTextField.keyboardType = UIKeyboardTypeNumberPad ;
    [inputView addSubview:self.authCodeTextField];
    
    //登录密码框
    self.loginPasswordTextField = [[UITextField alloc] initWithFrame:CGRectMake(kScreenWidthTen * 1.5, inputSpaceValue / 4 + inputSpaceValue * 2, kScreenWidth / 2, inputSpaceValue / 2)];
    self.loginPasswordTextField.placeholder = @"请输入登录密码";
    self.loginPasswordTextField.textAlignment = NSTextAlignmentLeft;
    self.loginPasswordTextField.secureTextEntry = YES;
    [inputView addSubview:self.loginPasswordTextField];
    
    //获取验证码标签
    self.getAuthLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidthEight * 5.5, inputSpaceValue / 4, kScreenWidthEight * 2, inputSpaceValue / 2)];
    self.getAuthLabel.font = [UIFont systemFontOfSize:12];
    self.getAuthLabel.backgroundColor = mainColor;
    self.getAuthLabel.layer.cornerRadius = 4;
    self.getAuthLabel.layer.masksToBounds = YES;
    self.getAuthLabel.text = @"获取验证码";
    self.getAuthLabel.textColor = [UIColor whiteColor];
    self.getAuthLabel.textAlignment = NSTextAlignmentCenter;
    [inputView addSubview:self.getAuthLabel];
    
    
    //获取验证码按钮
    self.needAuthBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.needAuthBtn.frame = CGRectMake(kScreenWidthEight * 5.5, inputSpaceValue / 4, kScreenWidthEight * 2, inputSpaceValue / 2);
    self.needAuthBtn.layer.cornerRadius = 4;
    self.needAuthBtn.layer.masksToBounds = YES;
    [self.needAuthBtn addTarget:self action:@selector(clickNeedAuth) forControlEvents:UIControlEventTouchUpInside];
    [inputView addSubview:self.needAuthBtn];
    
    //验证并登录按钮
    self.authAndLoginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.authAndLoginBtn.frame = CGRectMake(kScreenWidthTen / 2, kScreenHeightEight * 4, kScreenWidth - kScreenWidthTen, kScreenHeightEight / 2);
    self.authAndLoginBtn.backgroundColor = mainColor;
    self.authAndLoginBtn.layer.cornerRadius = 5;
    [self.authAndLoginBtn setTitle:@"验证并修改" forState:UIControlStateNormal];
    [self.authAndLoginBtn addTarget:self action:@selector(authAndLoginPush) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.authAndLoginBtn];
    
    //创建一个轻拍手势 回收键盘
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
    
    [self.view addGestureRecognizer:tap];
    
    
    
    
}
//==============================================================================

#pragma mark 点击获取验证码
- (void)clickNeedAuth{
    
    //网络请求
    [self NetworkRequests];
    
    //    //定时器
    //    self.getAuthLabel.backgroundColor = [UIColor grayColor];
    //    self.timer = [[TestTimer alloc] init];
    //    __weak typeof(self) bSelf = self;
    //    [_timer makeTimerClickButton:bSelf.needAuthBtn clickLabel:bSelf.getAuthLabel    addressStr: STORE_TIMER];
    
}

#pragma mark 网络请求
- (void) NetworkRequests{
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    Access_token *useAccess = [Access_token shareInstance];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"access_token" : useAccess.access_token,
                           @"mobile" : self.movebiephoneNumberTextField.text
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName,kNetModifyPhoneNumberNote];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        
        NSDictionary *dic = responseObject;
        
        self.status = dic[@"status"];
        
        self.msg = dic[@"msg"];
        
        NSDictionary *info = dic[@"info"];
        
        
        self.code = info[@"code"];
        
        
        [self resultAnalysis];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        [HUD hideAnimated:YES];
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
    }];
    
}

//==============================================================================

#pragma mark 修改后跳转到主页
- (void)authAndLoginPush{
    
    //回收键盘
    [self.view endEditing:YES];

    
    self.authCodeStr = [self.authCodeTextField.text md5String];
    
      

    if ([self.authCodeStr isEqualToString:self.code]) {
        
        [self NetworkRequestsTWO];
        
    } else {
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"验证码错误" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];

        
    }
    
    
 
    
}

//==============================================================================

#pragma mark 返回值分析
- (void) resultAnalysis {
    
    int status = [self.status intValue];
    
    switch (status) {
        case 99:{
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 98:{
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 97:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 96:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 1:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 2:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 3:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
        case 4:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
        case 5:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
            
        case 100:
        {
            
            //定时器
            self.getAuthLabel.backgroundColor = [UIColor grayColor];
            self.timer = [[TestTimer alloc] init];
            __weak typeof(self) bSelf = self;
            [_timer makeTimerClickButton:bSelf.needAuthBtn clickLabel:bSelf.getAuthLabel    addressStr: STORE_TIMER];
            
        }
            break;
            
        default:
            break;
    }
    
    
    
}





//==============================================================================

//结束编辑,点击空白回收键盘
- (void)tap
{
    //回收键盘
    [self.view endEditing:YES];
}
//==============================================================================


#pragma mark 键盘只能输入数字
//==============================================================================
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    return [self validateNumber:string];
}

- (BOOL)validateNumber:(NSString*)number {
    BOOL res = YES;
    NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
    int i = 0;
    while (i < number.length) {
        NSString * string = [number substringWithRange:NSMakeRange(i, 1)];
        NSRange range = [string rangeOfCharacterFromSet:tmpSet];
        if (range.length == 0) {
            res = NO;
            break;
        }
        i++;
    }
    return res;
}
//==============================================================================

//返回上一页
- (void)backTpMainView{
    
    [self.navigationController popViewControllerAnimated:nil];
    
}


#pragma mark 网络请求
- (void) NetworkRequestsTWO{
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    Access_token *useAccess = [Access_token shareInstance];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"access_token" : useAccess.access_token,
                           @"mobile" : self.movebiephoneNumberTextField.text,
                           @"password" : self.loginPasswordTextField.text,
                           @"code" : self.authCodeTextField.text
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName,kNetModifyPhoneNumber];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        
        NSDictionary *dic = responseObject;
        
        self.status1 = dic[@"status"];
        
        self.msg1 = dic[@"msg"];

        [self resultAnalysisTWO];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        [HUD hideAnimated:YES];
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
    }];
    
}

#pragma mark 返回值分析
- (void) resultAnalysisTWO {
    
    int status = [self.status1 intValue];
    
    switch (status) {
        case 99:{
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 98:{
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 97:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 96:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 1:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 2:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 3:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
        case 4:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
        case 5:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
         
        case 6:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;

            
        case 100:
        {
            
            
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg1 preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                //定时器
                self.getAuthLabel.backgroundColor = [UIColor grayColor];
                self.timer = [[TestTimer alloc] init];
                __weak typeof(self) bSelf = self;
                [_timer makeTimerClickButton:bSelf.needAuthBtn clickLabel:bSelf.getAuthLabel    addressStr: STORE_TIMER];
                
                
                //跳转到主页
                MainPageViewController *mainView = [[MainPageViewController alloc] init];
                
                [self.navigationController pushViewController:mainView animated:nil];

            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            


        }
            break;
            
        default:
            break;
    }
    
    
    
}

@end
